package org.zeroes.common_prelude;

public class Mat3 {
	
	float a;
	float b;
	float c;
	float d;
	float e;
	float f;
	private float[][] array = new float[3][3];
	
	public Mat3(float a, float b, float c, float d, float e, float f){
		
		this.a=a;
		this.b=b;
		this.c=c;
		this.d=d;
		this.e=e;
		this.f=f;
		
		array[0][0]=a;
		array[0][1]=c;
		array[0][2]=e;
		
		array[1][0]=b;
		array[1][1]=d;
		array[1][2]=f;
		
		array[2][0]=0;
		array[2][1]=0;
		array[2][2]=1;
		
		
		
	}
	
	public float[][] getData(){
		
		return array;
		
	}
	
	public Mat3 multwithMat(Mat3 m){
		
		float[][] array2=m.getData();
		float[][] array1=new float[3][3];
		float[][] array3=new float[3][3];
		for(int i = 0; i <3; i++) {

            for(int j = 0; j <3; j++) {
        array1[i][j]=array[i][j];
            	
            }
		}
		
       
		for(int i = 0; i <3; i++) {

            for(int j = 0; j <3; j++) {

              for(int k = 0; k <3; k++){

                array3[i][j] +=array1[i][k]*array2[k][j];

              }
            } 
           }

		for(int i = 0; i <3; i++) {

            for(int j = 0; j <3; j++) {
        array[i][j]=array3[i][j];
            	
            }
		}
		
		return this;
	}
	
	public float[] applyforPoint(float x, float y){
		float[] dest = new float[3];
		dest[0]=array[0][0]*x+array[0][1]*y+array[0][2];
		dest[1]=array[1][0]*x+array[1][1]*y+array[1][2];
		dest[2]=1;
		return dest;
	}
	private void init(){
		
		
		
	}

}
